

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@ page import="entities.*"
			import="java.util.*"%>

<% Cliente c = (Cliente) request.getAttribute("cliente"); 
	Rutina r = (Rutina) request.getAttribute("rutina");
	
	List <ItemRutina> itemsRutinaTodas = r.getItemsRutina();
	
	List <ItemRutina> itemsRutinaLunes = new ArrayList <ItemRutina>();
	List <ItemRutina> itemsRutinaMartes = new ArrayList <ItemRutina>();
	List <ItemRutina> itemsRutinaMiercoles = new ArrayList <ItemRutina>();
	List <ItemRutina> itemsRutinaJueves = new ArrayList <ItemRutina>();
	List <ItemRutina> itemsRutinaViernes = new ArrayList <ItemRutina>();
	List <ItemRutina> itemsRutinaSabado = new ArrayList <ItemRutina>();
	List <ItemRutina> itemsRutinaDomingo = new ArrayList <ItemRutina>();
	ItemRutina ir = new ItemRutina();
	
	for (int i =0; i<itemsRutinaTodas.size();i++){
		ir = itemsRutinaTodas.get(i);
		if (ir.getDia().equals("lunes")){
			itemsRutinaLunes.add(ir);
		}
		if (ir.getDia().equals("martes")){
			itemsRutinaMartes.add(ir);
		}
		if (ir.getDia().equals("miercoles")){
			itemsRutinaMiercoles.add(ir);
		}
		if (ir.getDia().equals("jueves")){
			itemsRutinaJueves.add(ir);
		}
		if (ir.getDia().equals("viernes")){
			itemsRutinaViernes.add(ir);
		}
		if (ir.getDia().equals("sabado")){
			itemsRutinaSabado.add(ir);
		}
		if (ir.getDia().equals("domingo")){
			itemsRutinaDomingo.add(ir);
		}
	}
		
%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Generar rutinas</title>
<style type="text/css">
th {text-align: left;}

</style>
</head>
<body>

<b>GENERAR RUTINA</b><br /><br />

<b>Nombre: </b><%= c.getNombre() %><br />
<b>Apellido: </b><%= c.getApellido() %><br />
<b>Nro documento: </b><%= c.getNroDoc() %><br />
<b>Rutina nro: </b><%= r.getIdRutina() %>
<br />
<br />

<b>LUNES</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator il = itemsRutinaLunes.iterator();
	while (il.hasNext()){
		ItemRutina irl = (ItemRutina)il.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1lunes" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1lunes" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1lunes" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>

<b>MARTES</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator im = itemsRutinaMartes.iterator();
	while (im.hasNext()){
		ItemRutina irl = (ItemRutina)im.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1martes" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1martes" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1martes" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>

<b>MIERCOLES</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator imi = itemsRutinaMiercoles.iterator();
	while (imi.hasNext()){
		ItemRutina irl = (ItemRutina)imi.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1miercoles" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1miercoles" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1miercoles" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>

<b>JUEVES</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator ij = itemsRutinaJueves.iterator();
	while (ij.hasNext()){
		ItemRutina irl = (ItemRutina)ij.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1jueves" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1jueves" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1jueves" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>

<b>VIERNES</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator iv = itemsRutinaViernes.iterator();
	while (iv.hasNext()){
		ItemRutina irl = (ItemRutina)iv.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1viernes" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1viernes" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1viernes" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>

<b>SABADO</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator is = itemsRutinaSabado.iterator();
	while (is.hasNext()){
		ItemRutina irl = (ItemRutina)is.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1sabado" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1sabado" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1sabado" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>

<b>DOMINGO</b>
</br>
</br>
<table border="1">
<tr>
	<th><strong>Ejercicio</strong></th>
	<th><strong>Rep</strong></th>
	<th><strong>Cant</strong></th>
</tr>

<% 	Iterator id = itemsRutinaDomingo.iterator();
	while (id.hasNext()){
		ItemRutina irl = (ItemRutina)id.next() ;%>
		
			<tr>
			<td><input type="text" name="ej1domingo" value="<%=irl.getEjercicio().getNombre() %>" size="12"/></td>
			<td><input type="text" name="rep1domingo" value="<%=irl.getRepeticiones() %>" size="1"/></td>
			<td><input type="text" name="cant1domingo" value="<%=irl.getCantidad() %>" size="1"/></td>
			</tr>
<% 		
	}
%>
</table>
</br>
</br>
</body>
</html>